<?php
/**
 * Created by JetBrains PhpStorm.
 * User: heimuya
 * Date: 13-9-11
 * Time: 下午9:03
 * 系统用户模块
 */
class UserModel extends Model{
    protected $_map = array(
        'username'      => 'name',
        'usertype'		=> 'type',
        'usernick'		=> 'nick'
    );
    /**
     * @param $uname 系统用户名
     */
    public function getUserInfo($uname){
        $where['nick'] = $uname;
        $result = array();
        if($userInfo = $this->where($where)->find()){
            return $this->parseFieldsMap($userInfo);
        }
        return false;
    }
	/**
	 * @param $infoArray 登陆信息
	 * @param $uid 用户id
	 */
	 public function setUserInfo($infoArray, $uid){
	 	$where['id'] = $uid;
		if($this->where($where)->save($infoArray)){
			return TRUE;
		}
		return FALSE;
	 }
}